<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/font-awesome.min.css}">
    <link rel="stylesheet" th:href="@{/css/pagination.css}">
    <link rel="stylesheet" th:href="@{/css/main.css}">
    <style>
        .tree li {
            list-style-type: none;
            cursor: pointer;
        }

        table tbody tr:nth-child(odd) {
            background: #F4F4F4;
        }

        table tbody td:nth-child(even) {
            color: #C00;
        }
    </style>
    <script th:src="@{/jquery/jquery-2.1.1.min.js}"></script>
    <script th:src="@{/jquery/jquery.pagination.js}"></script>
    <script th:src="@{/bootstrap/js/bootstrap.min.js}"></script>
    <script th:src="@{/script/docs.min.js}"></script>
    <script type="text/javascript">
        $(function () {
            $(".list-group-item").click(function () {
                if ($(this).find("ul")) {
                    $(this).toggleClass("tree-closed");
                    if ($(this).hasClass("tree-closed")) {
                        $("ul", this).hide("fast");
                    } else {
                        $("ul", this).show("fast");
                    }
                }
            });
            initPagination();
        });
        function initPagination() {
            // 获取分页数据中的总记录数
            var totalRecord = $("#total").val();
            //声明 Pagination 设置属性的 JSON 对象
            var properties={
                num_edge_entries: 3, // 边缘页数
                num_display_entries: 5, // 主体页数
                callback: pageSelectCallback, // 用户点击“翻页”按钮之后执行翻页操作的回调函数
                current_page:$("#pageNum").val()-1, // 当前页，pageNum 从 1 开始，必须-1 后才可以赋值
                prev_text: "上一页",
                next_text: "下一页",
                items_per_page:$("#pageSize").val() // 每页显示的数量
            };
            // 调用分页导航条对应的 jQuery 对象的 pagination()方法生成导航条
            $("#Pagination").pagination(totalRecord, properties);
        };
        function pageSelectCallback(pageIndex,jQuery) {
            var pageNum = pageIndex + 1;
            var keyword = $("#keyword").val();

            window.location.href="[[@{/admin/get/page}]]"+"?pageNum="+pageNum+"&keyword="+keyword;

            return false;
        }
    </script>
</head>

<body>

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <div><a class="navbar-brand" style="font-size:32px;" th:href="@{/admin/get/page}">众筹平台 - 用户维护</a></div>
        </div>
        <div id="navbar" class="navbar-collapse collapse">
            <ul class="nav navbar-nav navbar-right">
                <li style="padding-top:8px;">
                    <div class="btn-group">
                        <button type="button" class="btn btn-default btn-success dropdown-toggle"
                                data-toggle="dropdown">
                            <i class="glyphicon glyphicon-user"></i> <span th:text="${session.loginAdmin.userName}"/> <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="#"><i class="glyphicon glyphicon-cog"></i> 个人设置</a></li>
                            <li><a href="#"><i class="glyphicon glyphicon-comment"></i> 消息</a></li>
                            <li class="divider"></li>
                            <li><a th:href="@{/admin/do/logout}"><i class="glyphicon glyphicon-off"></i> 退出系统</a></li>
                        </ul>
                    </div>
                </li>
                <li style="margin-left:10px;padding-top:8px;">
                    <button type="button" class="btn btn-default btn-danger">
                        <span class="glyphicon glyphicon-question-sign"></span> 帮助
                    </button>
                </li>
            </ul>
            <form class="navbar-form navbar-right">
                <input type="text" class="form-control" placeholder="Search...">
            </form>
        </div>
    </div>
</nav>

<div class="container-fluid">
    <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            <div class="tree">
                <ul style="padding-left:0px;" class="list-group">
                    <li class="list-group-item tree-closed">
                        <a th:href="@{/admin/to/main}"><i class="glyphicon glyphicon-dashboard"></i> 控制面板</a>
                    </li>
                    <li class="list-group-item">
                        <span><i class="glyphicon glyphicon glyphicon-tasks"></i> 权限管理 <span class="badge"
                                                                                             style="float:right">3</span></span>
                        <ul style="margin-top:10px;">
                            <li style="height:30px;">
                                <a th:href="@{/admin/get/page}" style="color:red;"><i class="glyphicon glyphicon-user"></i> 用户维护</a>
                            </li>
                            <li style="height:30px;">
                                <a th:href="@{/role/to/page}"><i class="glyphicon glyphicon-king"></i> 角色维护</a>
                            </li>
                            <li style="height:30px;">
                                <a th:href="@{/menu/to/page}"><i class="glyphicon glyphicon-lock"></i> 菜单维护</a>
                            </li>
                        </ul>
                    </li>
                    <li class="list-group-item tree-closed">
                        <span><i class="glyphicon glyphicon-ok"></i> 业务审核 <span class="badge"
                                                                                style="float:right">3</span></span>
                        <ul style="margin-top:10px;display:none;">
                            <li style="height:30px;">
                                <a href="auth_cert.html"><i class="glyphicon glyphicon-check"></i> 实名认证审核</a>
                            </li>
                            <li style="height:30px;">
                                <a href="auth_adv.html"><i class="glyphicon glyphicon-check"></i> 广告审核</a>
                            </li>
                            <li style="height:30px;">
                                <a href="auth_project.html"><i class="glyphicon glyphicon-check"></i> 项目审核</a>
                            </li>
                        </ul>
                    </li>
                    <li class="list-group-item tree-closed">
                        <span><i class="glyphicon glyphicon-th-large"></i> 业务管理 <span class="badge" style="float:right">7</span></span>
                        <ul style="margin-top:10px;display:none;">
                            <li style="height:30px;">
                                <a href="cert.html"><i class="glyphicon glyphicon-picture"></i> 资质维护</a>
                            </li>
                            <li style="height:30px;">
                                <a href="type.html"><i class="glyphicon glyphicon-equalizer"></i> 分类管理</a>
                            </li>
                            <li style="height:30px;">
                                <a href="process.html"><i class="glyphicon glyphicon-random"></i> 流程管理</a>
                            </li>
                            <li style="height:30px;">
                                <a href="advertisement.html"><i class="glyphicon glyphicon-hdd"></i> 广告管理</a>
                            </li>
                            <li style="height:30px;">
                                <a href="message.html"><i class="glyphicon glyphicon-comment"></i> 消息模板</a>
                            </li>
                            <li style="height:30px;">
                                <a href="project_type.html"><i class="glyphicon glyphicon-list"></i> 项目分类</a>
                            </li>
                            <li style="height:30px;">
                                <a href="tag.html"><i class="glyphicon glyphicon-tags"></i> 项目标签</a>
                            </li>
                        </ul>
                    </li>
                    <li class="list-group-item tree-closed">
                        <a href="param.html"><i class="glyphicon glyphicon-list-alt"></i> 参数管理</a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="glyphicon glyphicon-th"></i> 数据列表</h3>
                </div>
                <div class="panel-body">
                    <form th:action="@{/admin/get/page}" method="post" class="form-inline" role="form" style="float:left;">
                        <div class="form-group has-feedback">
                            <div class="input-group">
                                <div class="input-group-addon">查询条件</div>
                                <input name="keyword" class="form-control has-success" type="text" placeholder="请输入查询条件">
                            </div>
                        </div>
                        <button type="submit" class="btn btn-warning"><i class="glyphicon glyphicon-search"></i> 查询
                        </button>
                    </form>
                    <button type="button" class="btn btn-danger" style="float:right;margin-left:10px;"><i
                            class=" glyphicon glyphicon-remove"></i> 删除
                    </button>
<!--                    <button type="button" class="btn btn-primary" style="float:right;"-->
<!--                            onclick="window.location.href='add.html'">-->
<!--                        <i class="glyphicon glyphicon-plus"></i> 新增-->
<!--                    </button>-->
                    <a th:href="@{/admin/to/add}" style="float:right;" class="btn btn-primary"><i class="glyphicon glyphicon-plus"></i> 新增</a>
                    <br>
                    <hr style="clear:both;">
                    <div class="table-responsive">
                        <table class="table  table-bordered">
                            <thead>
                            <tr>
                                <th width="30">#</th>
                                <th width="30"><input type="checkbox"></th>
                                <th>账号</th>
                                <th>名称</th>
                                <th>邮箱地址</th>
                                <th width="100">操作</th>
                            </tr>
                            </thead>
                            <tbody th:if="${#lists.isEmpty(pageInfo.list)}">
                                <tr colspan="6" align="center">抱歉，没有您要显示的数据！</tr>
                            </tbody>
                            <tbody th:if="${!#lists.isEmpty(pageInfo.list)}">
                                <tr th:each="admin : ${pageInfo.list}">
                                    <td th:text="${admin.id}"></td>
                                    <td><input type="checkbox"></td>
                                    <td th:text="${admin.login}"></td>
                                    <td th:text="${admin.userName}"></td>
                                    <td th:text="${admin.email}"></td>
                                    <td>
                                        <a th:href="@{/assign/to/role(adminId=${admin.id},pageNum=${pageInfo.pageNum},keyword=${param.keyword})}" class="btn btn-success btn-xs">
                                            <i class=" glyphicon glyphicon-check"></i>
                                        </a>
                                        <a th:href="@{/admin/to/edit(adminId=${admin.id},pageNum=${pageInfo.pageNum},keyword=${param.keyword})}" class="btn btn-primary btn-xs">
                                            <i class=" glyphicon glyphicon-pencil"></i>
                                        </a>
                                        <a th:href="@{/admin/remove(adminId=${admin.id},pageNum=${pageInfo.pageNum},keyword=${param.keyword})}" class="btn btn-danger btn-xs">
                                            <i class=" glyphicon glyphicon-remove"></i>
                                        </a>
                                    </td>
                                </tr>
                            </tbody>
                            <tfoot>
                                <tr>
                                    <td colspan="6" align="center">
                                        <input type="hidden" id="total" th:value="${pageInfo.total}">
                                        <input type="hidden" id="pageNum" th:value="${pageInfo.pageNum}">
                                        <input type="hidden" id="pageSize" th:value="${pageInfo.pageSize}">
                                        <input type="hidden" id="keyword" th:value="${param.keyword}">
                                        <div id="Pagination" class="pagination"><!-- 这里显示分页 --></div>
                                    </td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
